package org.atf.model.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;


@Entity
@Table
@NamedQueries({
	 @NamedQuery(name="Preference.findPreferenceByScope",
            	query="select p from Preference p where p.scope = :scope"),
    @NamedQuery(name="Preference.findPreferenceByName",
            	query="select p from Preference p where p.pName = :name"),
    @NamedQuery(name="Preference.findPreferenceByNameScope",
             	query="select p from Preference p where p.pName = :name and p.scope= :scope")
})
public class Preference implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = -8714100468603774615L;
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "PREFERENCE_ID")
	private Integer id;
	private String pName;
	private String pValue;
	private String description;
	private String scope;
	
	public Preference(){
		
	}
	public Preference(String name, String value, String desc, String scope){
		this.pName=name;
		this.pValue=value;
		this.description= desc;
		this.scope= scope;
	}
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getpName() {
		return pName;
	}
	public void setpName(String pName) {
		this.pName = pName;
	}
	public String getpValue() {
		return pValue;
	}
	public void setpValue(String pValue) {
		this.pValue = pValue;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	
	
	public String getScope() {
		return scope;
	}
	public void setScope(String scope) {
		this.scope = scope;
	}
	@Override
	public String toString() {
		return "Preference [id=" + id + ", pName=" + pName + ", pValue="
				+ pValue + ", description=" + description + ", scope=" + scope
				+ "]";
	}
	
	
}
